﻿#region Usings

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

#endregion

namespace RailNet.Dao.Entity
{
    [DisplayColumn("RelationNumber")]
    [Serializable]
    public class Relation : IEquatable<Relation>, IEntity
    {
        #region Primitive Properties

        [Key]
        public long Id { get; set; }

        [Required]
        public int RelationNumber { get; set; }

        [Required]
        [MaxLength(150)]
        public string Route { get; set; }

        [Required]
        public DateTime ValidFrom { get; set; }

        [Required]
        public DateTime ValidTo { get; set; }

        [Required]
        [MaxLength(12)]
        public string BorderStation { get; set; }

        [Required]
        [MaxLength(12)]
        public string DestinationStation { get; set; }

        #endregion

        #region Navigation Properties

        [InverseProperty("Relation")]
        public virtual ICollection<RelationRu> RelationRus { get; set; }

        [InverseProperty("Relation")]
        public virtual ICollection<RelationDescription> Descriptions { get; set; }

        #endregion

        #region IEquatable members

        public bool Equals(Relation other)
        {
            return Id == other.Id;
        }

        #endregion
    }
}